﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DiscoveryLogic.Common.Numeric
{
    /// <summary> This empty class is the common root for all persistent capable classes.
    /// If this class inherits from <tt>java.lang.Object</tt> then all subclasses are serializable with the standard Java serialization mechanism.
    /// If this class inherits from <tt>com.objy.db.app.ooObj</tt> then all subclasses are <i>additionally</i> serializable with the Objectivity ODBMS persistance mechanism.
    /// Thus, by modifying the inheritance of this class the entire tree of subclasses can be switched to Objectivity compatibility (and back) with minimum effort.
    /// </summary>
    [Serializable]
    public abstract class PersistentObject : ICloneable
    {
        public const long serialVersionUID = 1020L;
        /// <summary> Not yet commented.</summary>
        protected internal PersistentObject()
        {
        }
        /// <summary> Returns a copy of the receiver.
        /// This default implementation does not nothing except making the otherwise <tt>protected</tt> clone method <tt>public</tt>.
        /// 
        /// </summary>
        /// <returns> a copy of the receiver.
        /// </returns>
        public virtual System.Object Clone()
        {
            try
            {
                return base.MemberwiseClone();
            }
            //UPGRADE_NOTE: Exception 'java.lang.CloneNotSupportedException' was converted to 'System.Exception' which has different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1100'"
            catch (System.Exception exc)
            {
                throw new System.ApplicationException(); //should never happen since we are cloneable
            }
        }
    }
}
